package com.mercury.tests;

import org.hibernate.*;
import com.mercury.beans.Customer;
import com.mercury.beans.HibernateUtil;

public class Test5b {
	public static void main(String[] args) {
		Session session = HibernateUtil.currentSession();
		
		String hql="from Customer where name='Carson'";
		Customer c  = (Customer)session.createQuery(hql).uniqueResult();
		System.out.println("**************************");
		System.out.println(c.getCid() + "\t"+ c.getName());
		
		Hibernate.initialize(c.getEmails());  //initialize
		
		HibernateUtil.closeSession();
		
		for(String email:c.getEmails()){
			System.out.println(email);
		}
	}
}
